package com.ericsson.rm.vo;

import java.io.Serializable;

import com.ericsson.rm.util.Utility;

public class ResourceSearchResponseVO implements Serializable, Comparable<ResourceSearchResponseVO> {
	
	private static final long serialVersionUID = -253322669211736550L;
	
	private String resourceId;
	public String signum;
	public String firstName;
	public String lastName;
	public String lineManagerSignum;
	public String jobStage;
	public String roleName;
	public String fromDate;
	public String toDate;
	public Integer totalAllocationPercentage;
	public String billablity;
	
	public ResourceSearchResponseVO() {
		super();
	}

	public String getResourceId() {
		return resourceId;
	}

	public void setResourceId(String resourceId) {
		this.resourceId = resourceId;
	}

	public String getSignum() {
		return signum;
	}

	public void setSignum(String signum) {
		this.signum = signum;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getLineManagerSignum() {
		return lineManagerSignum;
	}

	public void setLineManagerSignum(String lineManagerSignum) {
		this.lineManagerSignum = lineManagerSignum;
	}

	public String getJobStage() {
		return jobStage;
	}

	public void setJobStage(String jobStage) {
		this.jobStage = jobStage;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getFromDate() {
		return fromDate;
	}

	public void setFromDate(String fromDate) {
		this.fromDate = fromDate;
	}

	public String getToDate() {
		return toDate;
	}

	public void setToDate(String toDate) {
		this.toDate = toDate;
	}

	public String getBillablity() {
		return billablity;
	}

	public void setBillablity(String billablity) {
		this.billablity = billablity;
	}

	public Integer getTotalAllocationPercentage() {
		return totalAllocationPercentage;
	}

	public void setTotalAllocationPercentage(Integer totalAllocationPercentage) {
		this.totalAllocationPercentage = totalAllocationPercentage;
		if(totalAllocationPercentage >= 100){
			setBillablity("Full Billable");
		} else if(totalAllocationPercentage == 0){
			setBillablity("Non Billable");
		} else {
			setBillablity("Partial Billable");
		}
	}

	@Override
	public int compareTo(ResourceSearchResponseVO obj) {
		int result = 0;
		if (Utility.isNotEmpty(obj)) {
			result = this.getResourceId().compareTo(obj.getResourceId());
		}
		
		return result;
	}

/*	@Override
	public int hashCode() {
		int result = 1;
		if (Utility.isNotEmpty(resourceId)) {
			result = Integer.valueOf(resourceId).hashCode();
		}
		
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof ResourceSearchResponseVO)) {
			return false;
		}
		ResourceSearchResponseVO other = (ResourceSearchResponseVO) obj;
		if (resourceId == null) {
			if (other.resourceId != null) {
				return false;
			}
		} else if (!resourceId.equals(other.resourceId)) {
			return false;
		}
		return true;
	}*/
	
	
}
